-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Track build file changes #168
Track build file changes #168
Conversation
019c186
to
0402ac4
Compare
This change makes the server register for document lifecycle events like didChange for build files. Previous behavior was to register for file system change events for build files, but eventually we want to give diagnostics, completions, etc. for build files as you type, so we need to track all changes. This change keeps existing behavior from the user's perspective, as we still only reload projects on save, so it serves mostly as a refactor. I also extracted the state managed by SmithyLanguageServer to its own class, ServerState, and flattened ProjectManager into that class, so we can manage the state of the server in a more centralized location.
0402ac4
to
9f1e92b
Compare
src/main/java/software/amazon/smithy/lsp/project/ProjectConfig.java
Outdated
Show resolved
Hide resolved
for (Project project : attachedProjects.values()) { | ||
ProjectFile projectFile = project.getProjectFile(path); | ||
if (projectFile != null) { | ||
detachedProjects.remove(uri); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im a little confused why we remove it from detached projects here? I would have thought that would get checked correctly in the isDetached below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea it does, but I'm not calling that method here. I think I meant to end up removing isDetached
, but it ended up being too useful. I did some refactoring and pulled the removal logic into the new findAttachedAndRemoveDetached
This change makes the server register for document lifecycle events like didChange for build files. Previous behavior was to register for file system change events for build files, but eventually we want to give diagnostics, completions, etc. for build files as you type, so we need to track all changes. This change keeps existing behavior from the user's perspective, as we still only reload projects on save, so it serves mostly as a refactor. I also extracted the state managed by SmithyLanguageServer to its own class, ServerState, and flattened ProjectManager into that class, so we can manage the state of the server in a more centralized location.
Fixes a bug in smithy-lang#168 where the server would send the wrong registration for didSave on Smithy files.
Fixes a bug in #168 where the server would send the wrong registration for didSave on Smithy files.
This change makes the server register for document lifecycle events like
didChange for build files. Previous behavior was to register for file
system change events for build files, but eventually we want to give
diagnostics, completions, etc. for build files as you type, so we need
to track all changes. This change keeps existing behavior from the
user's perspective, as we still only reload projects on save, so it
serves mostly as a refactor.
I also extracted the state managed by SmithyLanguageServer to its own
class, ServerState, and flattened ProjectManager into that class, so we
can manage the state of the server in a more centralized location.
Depends on #167
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.